package com.tjbank.cssys.web.util;

import com.tjbank.cssys.config.IYCPEncryptor;

import javax.servlet.http.HttpServletRequest;

public class GetUserCodeFromToken {


    public static String getUserCode(HttpServletRequest httpRequest) throws Exception {
        String token = httpRequest.getHeader("Access-Token");
        // 2、对token解密,获取登陆码
        String decrypt = IYCPEncryptor.decrypt(token);
        String loginCode = decrypt.substring(0, decrypt.indexOf("_"));
        return loginCode;
    }
}
